package com.pinyougou.manager.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.security.core.context.SecurityContextHolder;

import java.util.HashMap;
import java.util.Map;

/**
 * @auther lmj
 * @date 2019/10/18
 */

@RestController
@RequestMapping("/login")
public class LoginController {
    /**
     * 获取当前登陆人的姓名
     * @return
     */
    @RequestMapping("/getLoginName")
    public Map getLoginName(){
        String name = SecurityContextHolder.getContext().getAuthentication().getName();
        Map nameMap = new HashMap();
        nameMap.put("loginName",name);
        return nameMap;
    }

}
